//
// Created by pengtg on 2020/2/22.
//

#ifndef ANDROIDVIDEOPLAYER_XTHREAD_H
#define ANDROIDVIDEOPLAYER_XTHREAD_H

//sleep 毫秒
void XSleep(int mis);

//C++ 11 线程库
class XThread
{
public:
    //启动线程
    virtual bool start();  //在Linux当中加了返回值就一定要有return

    //通过控制isExit安全停止线程（不一定成功）
    virtual void stop();

    virtual void SetPause(bool isP);
    virtual bool IsPause()
    {
        isPausing = isPause;
        return isPause;
    }
    //入口主函数
    virtual void Main(){}

protected:
    bool isExit = false;
    bool isRuning = false;
    bool isPause = false;
    bool isPausing = false;
private:
    void ThreadMain();
};


#endif //ANDROIDVIDEOPLAYER_XTHREAD_H
